package com.cserver.pro.controller;


import com.cserver.pro.entity.Student;
import com.cserver.pro.service.StudentService;
import com.cserver.pro.service.StudentServiceFade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 学生表(Student)表控制层
 *
 * @author makejava
 * @since 2020-02-29 21:38:30
 */
@RestController
@RequestMapping("student")
public class StudentController {
    /**
     * 服务对象
     */
    @Autowired
    private StudentService studentService;


    @Autowired
    private StudentServiceFade studentServiceFade;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Student selectOne(Integer id) {

        return this.studentService.queryById(id);
    }

    @GetMapping("insertStudent")
    public String insetStudent(){
        Student student = new Student();
        student.setName("张三");
        student.setSex("男");
        studentServiceFade.insert(student);
        return "成功";
    };
}